Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unwanted exceptions from dac 15 class. #324

Merged
merged 1 commit into from
Mar 9, 2016
Merged

Conversation

JulianSKelly
Copy link
Contributor

Fixes #323

Change error checking for when two jump table commands are executed too closely in time, rather than too closely in memory.

@@ -1430,7 +1430,7 @@ def make_jump_table_entry(cls, name, arg):
:param str name: one of: END, NOP, IDLE, CYCLE, JUMP, CHECK, RAMP
:param list[int] arg: arguments for the op.
:return: list of jump table entries
:rtype: list[jump_table.JumpEntry]
:rtype: jump_table.JumpEntry
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

huh, good catch here.

('NOP', [16]),
('NOP', [20]),
('END', [400])
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's best here to split these cases into separate test methods and give them descriptive names rather than having multiple cases within one methods with comments to explain what's different. I also generally think that if test methods are small, test one thing, and named descriptively, then docstrings are usually not needed on each method.

def test_nop_nop_from_addr_too_close(self):
    entries = self.make_entries([
        ('NOP', [16]),
        ('NOP', [20]),
        ('END', [400])
    ])
    with pytest.raises(AssertionError):
        self.dac.make_jump_table(entries)

def test_jump_nop_from_addr_too_close(self):
    ...

Obviously this slightly increases the amount of boilerplate, but I think it makes debugging test failures much easier.

@JulianSKelly
Copy link
Contributor Author

@maffoo @pomalley I believe I have addressed everything

@maffoo
Copy link
Contributor

maffoo commented Feb 27, 2016

A couple of comments, but otherwise LGTM.

@JulianSKelly
Copy link
Contributor Author

Addressed your comments. Will merge after I can test on hardware to make sure nothing funny happened.

@JulianSKelly
Copy link
Contributor Author

@maffoo Checked this on hardware and found a missing error for jump tables that are too long.

Can you inspect latest commit and LGTM if ready?

@JulianSKelly
Copy link
Contributor Author

@maffoo please see my changes.

@JulianSKelly
Copy link
Contributor Author

Also looks like teamcity is barfing on futures

@JulianSKelly
Copy link
Contributor Author

@maffoo, can you take another look?

@maffoo
Copy link
Contributor

maffoo commented Mar 9, 2016

LGTM

Improve documentation for jump_table in dac.py
Add test_dac
Change dac build 15 offsets:
*JT_MIN_FROM_ADDR_SPACING -> JT_MIN_CLK_CYCLES_BETWEEN_OPCODES
*JT_MIN_CLK_CYCLES_BETWEEN_OPCODES: 2->4 in line with GHZDAC8 specs
*JT_MIN_FROM_ADDR remove offset
*JT_MIN_END_ADDR remove offset
Fixes #323
*Add test, error for long jump tables

Review: @maffoo
@JulianSKelly JulianSKelly merged commit 2310d0e into master Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dac.py raises jump table error incorrectly
4 participants